import java.io.*;
public class Test6_9 {
    public static void main(String[]args){
        String s = "";
        int t;
        while(true){
            try{
                System.out.println("请输入学生人数");
                BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
                s = in.readLine();
                t = Integer.parseInt(s);
                if(t<0)
                    throw new NegException("人数不能为负数");
                System.out.println("你输入的人数是" + t);
                break;
            }
            catch(IOException e){
                System.out.println(e);
            }
            catch(NegException e){
                System.out.println(e);
            }
        }
    }
}
class NegException extends Exception{
    public NegException(String message){
        super(message);
    }
}

